-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Annotate Extensions.Options to make it linker friendly #40294
Conversation
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @maryamariyan |
src/libraries/Microsoft.Extensions.Options/tests/TrimmingTests/ConfigureTests.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SWEET 😄
Failure is #40115. |
346c906
to
565a993
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think CI also shows apicompat error for linker tests
e.g.:
.packages/microsoft.dotnet.apicompat/5.0.0-beta.20381.6/build/Microsoft.DotNet.ApiCompat.targets(82,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build) TypesMustExist : Type 'Microsoft.Extensions.DependencyInjection.DefaultServiceProviderFactory' does not exist in the implementation but it does exist in the contract. [/Users/runner/work/1/s/src/libraries/Microsoft.Extensions.DependencyInjection/src/Microsoft.Extensions.DependencyInjection.csproj]
re-running. I don't think my change caused these errors. |
* Annotate Extensions.Options to make it linker friendly Fix dotnet#40236
I choose to annotate the following interfaces and their implementations:
I didn't annotate
AddOptions<TOptions>
,OptionsBuilder<TOptions>
,Configure
,PostConfigure
, orValidate
because these operations don't actually create an Options class - they just consume one. It is only once someone tries getting an Options from the ServiceProvider when the class actually gets instantiated. And they way they get the Options is through one of the above annotated interfaces.Fix #40236